<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
        <title>Quocity</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){

           //var url = "http://twitter.com/status/user_timeline/quocity.json?count=3&callback=?";
           var url = "http://api.quocity.com/quocity.svc/xml/cities?callback=?";
           //url = "test.txt";
           /*$.getJSON(url, function(data){
           		alert(data);
               $.each(data, function(i, item) {
                   //$("img#profile").attr("src", item.user["profile_image_url"]); 
                   //$("#tweets ul").append("<li><span>" + item["text"] + "</span><small>" + item["created_at"] + "</small></li>");
                   
                   $("#tweets ul").append("<li><span>" + item["Name"] + "</span><small> - id:" + item["Id"] + "</small></li>");
               });
           });*/
           
        $(document).ready(function () {
           
        	$.ajax({
        			type: "GET",
        			url: url,
        			dataType: "xml",
        			success: function(xml) {
        				$(xml).find('ArrayOfCity').each(function(){
        					
        					var id = $(this).find('Id').text();
        					var name = $(this).find('Name').text();
        					
        					alert(name);
        					
        					});
        				});
        			}
        		});   
    
           
           
        });
        </script>
    </head>
    <body>
    
    <div id="twitter">
    	<h1>Cuadro para probar Cliente Twitter</h1>
    	
    	<div id="tweets">
    	    <img id="profile">
    	    <ul></ul>
    	</div>
    	
    	
    	
    	
    </div>
    
    <div id="login">
    	<h1>Cuadro para probar loggin OpenID</h1>
    	<?php if ( isset ( $_SESSION['googleIdentifier'] ) ) { ?>
    	
    		Usuario:<b><?= $_SESSION['name'] ?></b> <a href="signout.php"><small>Cerrar</small></a>
    	
    	
    	
    	<?php } else { ?>
    		
    		<iframe src="http://quocity.rpxnow.com/openid/embed?token_url=http%3A%2F%2Fwww.ismaelgaudioso.es%2Frpx.php" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px"></iframe>
    	
    	<?php } ?>
    	
    </div>
    
    </body>
</html>
